# Contributor: Oleg Titov <oleg.titov@gmail.com>
# Maintainer: Oleg Titov <oleg.titov@gmail.com>
pkgname=py3-wsgiprox
pkgver=1.5.2
pkgrel=0
pkgdesc="Python WSGI Middleware for adding HTTP/S proxy support to any WSGI Application"
url="https://github.com/webrecorder/wsgiprox"
arch="noarch"
license="Apache-2.0"
depends="py3-certauth py3-gevent-websocket py3-six"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="
	py3-gevent
	py3-mock
	py3-pytest
	py3-pytest-cov
	py3-requests
	py3-waitress
	py3-websocket-client
	"
subpackages="$pkgname-pyc"

source="py3-wsgiprox-$pkgver.tar.gz::https://files.pythonhosted.org/packages/source/w/wsgiprox/wsgiprox-$pkgver.tar.gz"
builddir="$srcdir/wsgiprox-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	# tests are known to fail for https,
	# https://github.com/webrecorder/wsgiprox/issues/6
	.testenv/bin/python3 -m pytest \
		--doctest-modules ./wsgiprox --cov wsgiprox -v test/ \
		-k "not https and not test_chunked_force_http10_buffer and not test_error_proxy_unsupported"
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
d07b97c7ce755b1f22cf250e553036b7196f7205ae2ba52655f5a3b0c6f210fec20d30ca2ff2576c752bf9468aa2fbbeda9db1843d69a85989e881c6f1ada777  py3-wsgiprox-1.5.2.tar.gz
"
